import request from "../../framework/common/utils/request";
import isUndefined from "lodash/isUndefined";
import message from "../../framework/common/utils/message";

//获取按钮对应信息
export default function(approveType, tplData, params) {
  return request({
    url: "/flowinstance/approval/get-approve-options",
    method: "POST",
    data:{
        action: approveType,
        package_id: tplData.package_id,
        proc_id: tplData.ProcessInfo.ProcessGuid,
        node_id: tplData.NodeInfo.node_id,
        step_type: tplData.StepInfo.step_type,
        opinion: tplData.NodeInfo && tplData.NodeInfo.opinion,
        is_end_task: tplData.NodeInfo && tplData.NodeInfo.is_end_task,
        is_sub_process_start: params.ParentProcess && params.ParentProcess.IsSubProcessStart
    }
  }).then(function (data) {
    return Promise.resolve(data);
  },function(error){
    message.info({
      content: "获取常用意见列表失败。",
    });
  });
}